home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: bcarter@ix.netcom.com(Robert Carter )
- Newsgroups: comp.lang.c++
- Subject: Re: VC++ v.4.0 conversion problems
- Date: 21 Jan 1996 18:12:40 GMT
- Organization: Netcom
- Message-ID: <4dtvmo$lak@ixnews2.ix.netcom.com>
- References: <4dls1n$ldp@eagle.novo.dk>
- NNTP-Posting-Host: pas-ca10-06.ix.netcom.com
- X-NETCOM-Date: Sun Jan 21 10:12:40 AM PST 1996
-
- In <4dls1n$ldp@eagle.novo.dk> morb@novo.dk (Morten Brun) writes:
- >
- >I am having a lot of problems when compiling under v.4. as I am etting
- >
- >a lot of conversions errors due to the new behavior of v.4 like:
- >----------------------------------------------------------------------
- ------
- >LPWSTR lpszName;
- >
- >GetPrivateProfileStringA("x", "y", "",lpszName, sizeof(lpszName),
- >\\xxx.INI");
- >
- >error c26664: cannot convert parm. 4 from unsigned short * to char *
- >----------------------------------------------------------------------
- ----------
- >or
- >error C2446: '=' : no conversion from 'char *' to 'unsigned char *'
- >error C2664: 'wcstombs' : cannot convert parameter 1 from 'unsigned
- >char [32]' error C2664: 'mbstowcs' : cannot convert parameter 2 from
- >'unsigned char *' to 'const char *'
- >error C2664: 'ctime' : cannot convert parameter 1 from 'unsigned long
- >*' to 'const long *'
- >----------------------------------------------------------------------
- -----------------
- >As I am e new to C++ and VC++ I have serious trouble in getting these
- >functions to work. Are there anybody which please could give me some
- >good ideas of how I without to much work can get my program to work ??
- >
- >Regards Morten
- >
- >
- >
- >Morten Brun
- >Novo Nordisk IT, Denmark
- >morb@novo.dk
- >
- The problem is with the LPWSTR. This is a Long Pointer to Wide STRing.
- It is for UNICODE stuff - two bytes per char.
- The "A" GetPrivateProfileStringA is for ASCII - one byte for char.
- You are asking to use a UNICODE string with an ASCII version of the
- routine.
- If you are using UNICODE through your program you need to include a
- define (check the conditional on the definition of
- GetPrivateProfileString - I don't have it in front of me)
- in the Program Settings. Then the header file for
- GetPrivateProfileString will define it to GetPrivateProfileW or the
- Unicode version.
- If a program is not ALL UNICODE or ASCII then you will need to use the
- UNICODE <-> ASCII conversion functions.
-
- Hope this helps,
- Bob Carter
- bcarter@netcom.com
-
-
-